/*
    Copyright (C) 2008  Helmut Juskewycz

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package com.juskewycz.dividere.action;

import com.juskewycz.dividere.action.join.IJoiner;
import com.juskewycz.dividere.action.join.OneThreadBufferJoiner;
import com.juskewycz.dividere.action.split.ISplitter;
import com.juskewycz.dividere.action.split.MultiThreadBufferSplitter;
import com.juskewycz.dividere.action.split.OneThreadBufferSplitter;

/**
 *
 * @author Helmut Juskewycz
 * @createdon 01. January 2007
 * @lastmodified 01. January 2007
 * @history
 */
public class MultiThreadActionFactory extends AActionFactory {

    @Override
    public IJoiner createJoiner() {
	return new OneThreadBufferJoiner();
    }

    @Override
    public ISplitter createSplitter() {
	if(Runtime.getRuntime().availableProcessors()>1) {
	    return new MultiThreadBufferSplitter();
	} else {
	    return new OneThreadBufferSplitter();
	}
    }

}
